<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBalancesTable extends Migration
{
  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
    Schema::create('balances', function (Blueprint $table) {
      $table->id();
      $table->string('order_id')->nullable();
      // $table->foreignId('member_id')->nullable();
      // $table->foreignId('seller_id')->nullable();
      $table->foreignId('user_id')->nullable();
      $table->enum('type', ['商户卖币(人工)', '商户卖币(接口)', '商户卖币手续费', '商户卖币扣奖励', '人工加币', '人工减币', '用户卖币', '用户卖币被拒', '商户买币', '用户买币', '用户买币佣金', '用户买币奖励', '代理佣金', '代理奖励', '提取佣金', '异常订单被扣']);
      $table->decimal('value', 16, 3);
      $table->unsignedDecimal('b4', 16, 3);
      $table->unsignedDecimal('after', 16, 3);
      $table->timestamps();
    });
  }

  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
    Schema::dropIfExists('balances');
  }
}
